package com.example.mybatis_plus_use.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 文章表
 * </p>
 *
 * @author zjh
 * @since 2025-01-16
 */
@Getter
@Setter
@TableName("article")
@Schema(description = "文章实体类")
public class Article extends Model<Article> {

    private static final long serialVersionUID = 1L;

    /**
     * 文章ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "文章ID")
    private Long id;

    /**
     * 文章标题
     */
    @TableField("title")
    @Schema(description = "文章标题")
    private String title;

    /**
     * 文章内容
     */
    @TableField("content")
    @Schema(description = "文章内容")
    private String content;

    /**
     * 分类ID
     */
    @TableField("category_id")
    @Schema(description = "分类ID")
    private Long categoryId;

    /**
     * 作者ID
     */
    @TableField("author_id")
    @Schema(description = "作者ID")
    private Long authorId;

    /**
     * 封面图片URL
     */
    @TableField("cover_image")
    @Schema(description = "封面图片URL")
    private String coverImage;

    /**
     * 浏览量
     */
    @TableField("view_count")
    @Schema(description = "浏览量")
    private Integer viewCount;

    /**
     * 点赞数
     */
    @TableField("like_count")
    @Schema(description = "点赞数")
    private Integer likeCount;

    /**
     * 状态：0-草稿，1-已发布，2-已下架
     */
    @TableField("status")
    @Schema(description = "状态：0-草稿，1-已发布，2-已下架")
    private Byte status;

    /**
     * 是否置顶：0-否，1-是
     */
    @TableField("is_top")
    @Schema(description = "是否置顶：0-否，1-是")
    private Byte isTop;

    /**
     * 创建时间
     */
    @TableField("create_time")
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField("update_time")
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    @Override
    public Serializable pkVal() {
        return this.id;
    }
}
